#include "ServeServices.h"
#include "DefaultUtils.h"
#include "SConsoleStats.h"

#include  <unistd.h>

extern int errno;

int echo(int fd)
{
    char buf[BUFSIZE];
    int cc;

    while((cc = read(fd,buf,sizeof(buf))))
    {
    if(cc<0)
        errexit("echo read:%s\n",strerror(errno));
        if(cc&&write(fd,buf,cc)<0)
            errexit("echo write :%s\n",strerror(errno));

    }
    return cc;
}
